{extend name='public/base' /}


{block name="content"}
<style type="text/css">
    .tittle {
        text-align: center;
        margin: 20px 0;
        font-size: 24px;
    }

    .box {
        width: 130px !important;
    }

    .auto {
        margin-left: 160px !important;
    }
</style>
<div class="layui-col-md12">

    <div class="layui-card">

        <div class="layui-card-body">

            <div class="layui-card-header">催费配置</div>
            <div class="layui-card-body">

                <div class="layui-form" lay-filter="">

                    <div class="tittle">手 动 配 置</div>

                    <div class="layui-form-item">
                        <label class="layui-form-label box">手动最多推送几次</label>
                        <div class="layui-input-inline">
                            <input type="number" name="most_send" value="" id="most_send" data-minvalue="1"
                                lay-verify="required" lay-vertype="tips" placeholder="请输入推送次数"
                                class="layui-input layui-form-danger">
                        </div>
                    </div>
                    <input type="hidden" name="__token__" id="token" value="{:token()}" />

                    <div class="layui-form-item">
                        <label class="layui-form-label box">手动推送密码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" value="" id="password" lay-verify="required"
                                lay-vertype="tips" placeholder="请输入手动推送密码" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <hr>

                    <div class="tittle">自 动 配 置</div>


                    <div class="layui-form-item">
                        <label class="layui-form-label box">自动推送周期</label>
                        <div class="layui-input-inline" style="width: 190px;">
                            <select lay-verify="required" name="cycle" id="cycle">
                                <option value=""></option>
                                <option value="0">一次</option>
                                <option value="1">周</option>
                                <option value="2">月</option>
                            </select>
                        </div>
                        <div class="layui-input-inline"  style="line-height:38px;font-size: 14px;color: red;width: 60%">提示：若选择一次，则取设置的时分秒作为推送时间；若选择按周推送，则选择日期的周几会作为每周的推送时间；（请选择08:00-21:00进行推送）</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label box">自动默认推送时间</label>
                        <div class="layui-input-inline">
                            <input type="text" name="send_time" value="" id="send_time" class="layui-input"
                                placeholder="请选择推送时间">
                        </div>
                    </div>

                    <div class="layui-form-item" style="visibility: hidden;">
                        <label class="layui-form-label">id</label>
                        <div class="layui-input-inline">
                            <input type="text" name="id" value="" id="id" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit="" lay-filter="setmypass">确认修改</button>
                        </div>
                    </div>


                </div>

            </div>


        </div>
    </div>

</div>


{/block}

{block name="js"}
<!--js处理区-->

<script>

    layui.use(['element', 'form', 'jquery', 'lucky'], function () {
        var element = layui.element;
        var form = layui.form;
        var $ = layui.jquery;
        var lucky = layui.lucky;

        form.render();

        /**
         * 表格{:__('Submit')}
         */
        form.on('submit(setmypass)', function (data) {
            lucky.FormSubmit("{:url('saveconfig')}", data.field);
            return false;
        });

        TableHeaders({});
        function TableHeaders(datas) {
            $.ajax({
                url: "{:url('index')}",
                type: "get",
                data: datas,
                dataType: "json",
                success: function (data) {
                    $("#most_send").val(data.data.most_send)
                    $("#password").val(data.data.password)
                    $("#id").val(data.data.id)
                    $("#send_time").val(data.data.send_time)
                    $("#is_send").val(data.data.is_send)
                    $("#cycle").val(data.data.cycle);
                    layui.form.render('select');
                    console.log(data)
                }
            });
        }
    });

    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#send_time', //指定元素
            format: 'yyyy-MM-dd HH:mm:ss',
            type: 'datetime'
        });
    });

</script>


{/block}